

$(function() {
   
    /*  */
    var myChart = echarts.init(document.getElementById('main'));

    // 指定图表的配置项和数据
    var dongjie = $("#p-sp1").text()*1;
    var benjin = $("#p-sp2").text()*1;
    var keyong  = $("#p-sp3").text()*1;
    var lixi = $("#p-sp4").text()*1;
    console.log("冻结"+dongjie);
    console.log("本金"+benjin);
    console.log("可用"+keyong);
    console.log("利息"+lixi);
    var option = {
        tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b}: {c} ({d}%)"
        },
        legend: {
            orient: 'vertical',
            data: ['', '', '', '']
        },
        series: [{
            name: '',
            type: 'pie',
            radius: ['73%', '100%'],
            avoidLabelOverlap: false,
            label: {
                normal: {
                    show: false,
                    position: 'center'
                },
                emphasis: {
                    show: true,
                    textStyle: {
                        fontSize: '30',
                        fontWeight: 'bold'
                    }
                }
            },
            labelLine: {
                normal: {
                    show: false
                }
            },
            data: [
                { value: dongjie, name: '' },
                { value: benjin, name: '' },
                { value: keyong, name: '' },
                { value: lixi, name: '' }
            ],
            hoverAnimation:false,
            itemStyle:{
                normal:{
                    color: function(params) {
                        var colorList = ['#93aeff','#71cfff','#feb33d','#ffe540'];
                        return colorList[params.dataIndex]
                    }
                }
            }

        }]
    };

    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);

})
